<template>
  <div class="setting">
    <van-cell title="拉黑">
      <!-- 使用 title 插槽来自定义标题 -->
      <template #default>
        <van-switch v-model="checked" size="24px" @input="onInput" />
      </template>
    </van-cell>

    <van-cell title="举报" to="/settingPage/inform" is-link> </van-cell>
  </div>
</template>

<script>
import { setBlack } from '@/api/setting.js'
import { Dialog } from 'vant'
export default {
  name: 'HelloWorld',
  props: {
    showViewPop: {
      type: Boolean,
      default: false,
    },
    msg: String,
  },
  data() {
    return {
      checked: false,
    }
  },
  mounted() {},
  methods: {
    onInput(checked) {
      Dialog.confirm({
        title: '提醒',
        message: '是否拉黑？',
        confirmButtonColor: '#3296fa',
      })
        .then(() => {
          setBlack({ black_uid: '' }).then((res) => {})
          this.checked = checked
        })
        .catch(() => {
          this.checked = !checked
        })
    },
  },
}
</script>

<style scoped lang="scss">
.inform {
  padding: 15px;
  &-title {
    font-size: 16px;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 16px;
    padding-bottom: 15px;
  }
  &-radio {
    .van-radio-group > div {
      margin-bottom: 20px;
    }
  }
  &-text {
    height: 114px;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 15px;
    font-size: 14px;
    margin-bottom: 24px;
    textarea {
      width: 100%;
      height: 100%;
      background: #f5f5f5;
      border-radius: 8px;
      border: none;
    }
  }
  &-upload {
    margin-bottom: 13px;
  }
  &-submit {
    height: 50px;
    background: linear-gradient(180deg, #3764ec 0%, #6b85f7 100%);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
  }
}
</style>
